from src.game.ai.state import State
from pymunk.vec2d import Vec2d

class GoNearPlayerState(State):
    
    def __init__(self, priority, entity):
        State.__init__(self, priority, entity)
    
    def shouldStart(self):
        if self.entity.world.player.distanceTo(Vec2d(self.entity.x, self.entity.y)) > 5:
            return True
        return False
    
    def shouldContinue(self):
        return self.shouldStart()
    
    def onStart(self):
        pass
    
    def update(self):
        self.entity.moveTo(self.entity.world.player.x, self.entity.world.player.y)